package com.bookshop.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.bookshop.entity.Permission;
import com.bookshop.entity.User;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author g2l
 * @since 2024-01-13
 */
public interface UserService extends IService<User> {

    public long login(String phoneNumber, String password);

    public long smsLogin(String phoneNumber);

    public int registerBySms(String phoneNumber, String password);

    public int register(User user);

    public int updatePassword(String phoneNumber, String newPassword);

    public int updateUsername(String phoneNumber, String newUsername);

    public int updatePhoneNumber(String phoneNumber, String newPhoneNumber);

    public int updatePicture(String phoneNumber, String newPicture);

    /**
     * 超级管理员可以做任何事，而管理员之间平级，即管理员之间不能任命或取消
     * 所以这里只有超级管理员能调用，在注解中加入权限限制
     */
    public int updateRoleId(String phoneNumber, Long newRoleId);

    public List<Permission> getPermissions(String phoneNumber);

    public User getUserByPhoneNumber(String phoneNumber);

    public int deleteUser(User user);

    public int addUser(User user);

    public User getUserByUsername(String nickname);

    public Map<String, String> getBasicInfo(int userId);
}
